import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'Home',
    component: Home,
    redirect: '/users',
    children: [
      {
        path: '/users',
        name: 'Users',
        component: () =>
          import(/* webpackChunkName: "users" */ '../views/Users/Users.vue')
      },
      {
        path: '/access',
        name: 'Access',
        component: () =>
          import(/* webpackChunkName: "access" */ '../views/Access/Access.vue')
      },
      {
        path: '/goods',
        name: 'Goods',
        component: () =>
          import(/* webpackChunkName: "goods" */ '../views/Goods/Goods.vue')
      },
      {
        path: '/orders',
        name: 'Orders',
        component: () =>
          import(/* webpackChunkName: "orders" */ '../views/Orders/Orders.vue')
      },
      {
        path: '/systems',
        name: 'Systems',
        component: () =>
          import(
            /* webpackChunkName: "systems" */ '../views/Systems/Systems.vue'
          )
      },
      {
        path: '/userinfo/:id',
        name: 'UserInfo',
        props: true,
        component: () =>
          import(
            /* webpackChunkName: "userinfo" */ '../views/Users/UserInfo.vue'
          )
      }
    ]
  },
  {
    path: '/*',
    component: () => import(/* webpackChunkName: "404" */ '../views/404.vue')
  }
]

const router = new VueRouter({
  routes
})

export default router
